package com.neusoft.shopping.manager.dao;

import com.neusoft.shopping.manager.entity.OrderEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class OrderDAOImpl  {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    RowMapper<OrderEntity> rowMapper =new BeanPropertyRowMapper<>(OrderEntity.class);

    public List<OrderEntity> quretAll(){
        String sql="select * from orderinfo";
        return jdbcTemplate.query(sql,rowMapper);
    }
//    public int add_oder(OrderEntity order){
//        String sql="insert into orderinfo values (null,?,?,?,?,?,?)";
//        return jdbcTemplate.update(sql,order.getOrderstate(),order.getTotalPrice(),order.getUserno(), order.getPhoneno(),order.getAddress(),order.getOrdetime());
//    }

}
